package com.company;

import java.util.Scanner;

public class Main34 {
    public static void main(String[] args) {
        Scanner sr = new Scanner(System.in);


            int x;
            System.out.println("你要求取那个值的范围素数:");
            x = sr.nextInt();
            boolean isPrime = true;
            int primeNUM = 0;
            for (int i = 2; i <= x; i++) {
                for (int j = 2; j < i; j++) {
                    if (i % j == 0) {
                        isPrime = false;
                        break;
                    }
                }
                if (isPrime) {
                    System.out.print(i + "\t");
                    primeNUM++;
                    if (primeNUM % 5 == 0)
                        System.out.println();
                }
                isPrime = true;
            }
            System.out.println();
            System.out.println("素数" + x + "范围内,一共有：" + primeNUM + "个素数");
        }
    }
